package vehicles.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import vehicles.processing.*;
import vehicles.*;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import org.jdesktop.application.Action;
import org.jdesktop.application.Application;
import org.jdesktop.application.ResourceMap;
import vehicles.util.*;
import vehicles.vehicle.*;

/*
 * VehicleEditor.java
 *
 * Created on 26-Mar-2009, 15:02:43
 * @author Niall O'Hara
 */
public class VehicleEditor extends javax.swing.JFrame {

    /** Creates new form VehicleEditor */
    public VehicleEditor(java.awt.Frame parent, Simulator p_appRoot) {

        appRoot = p_appRoot;
        vehicleArray = appRoot.getVehicleArray();
        vehiclesDropDown = new DefaultComboBoxModel(vehicleArray);

        proVehiclePreview = new VehiclePreview();
        // important to call this whenever embedding a PApplet.
        // It ensures that the animation thread is started and
        // that other internal variables are properly set.
        proVehiclePreview.init();
        
        initComponents();

        proVehiclePreview.updateSize(processing_Appearance.getWidth(), processing_Appearance.getHeight());

        populateFields(vehicleArray[0]);
        updateColour();
    }

    @Action
    public void cancel() {
        dispose();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panel_SelectedVehicle = new JPanel();
        dropdown_SelectedVehicle = new JComboBox();
        tabContainer = new JTabbedPane();
        tab_Properties = new JPanel();
        panel_Name = new JPanel();
        text_Name = new JTextField();
        panel_Author = new JPanel();
        text_Author = new JTextField();
        panel_Description = new JPanel();
        scrollpanel_Description = new JScrollPane();
        text_Description = new JTextArea();
        panel_LastModified = new JPanel();
        text_LastModified = new JTextField();
        panel_Appearance = new JPanel();
        processing_Appearance = new JPanel();
        panel_Blue = new JPanel();
        slider_Blue = new JSlider();
        text_Blue = new JTextField();
        panel_Green = new JPanel();
        slider_Green = new JSlider();
        text_Green = new JTextField();
        panel_Red = new JPanel();
        slider_Red = new JSlider();
        text_Red = new JTextField();
        tab_Design = new JPanel();
        panel_LeftSensor = new JPanel();
        panel_Left_Light = new JPanel();
        slider_Left_Light = new JSlider();
        text_Left_Light = new JTextField();
        panel_Left_Heat = new JPanel();
        slider_Left_Heat = new JSlider();
        text_Left_Heat = new JTextField();
        panel_Left_Water = new JPanel();
        slider_Left_Water = new JSlider();
        text_Left_Water = new JTextField();
        panel_Left_Power = new JPanel();
        slider_Left_Power = new JSlider();
        text_Left_Power = new JTextField();
        panel_RightSensor = new JPanel();
        panel_Right_Light = new JPanel();
        slider_Right_Light = new JSlider();
        text_Right_Light = new JTextField();
        panel_Right_Heat = new JPanel();
        slider_Right_Heat = new JSlider();
        text_Right_Heat = new JTextField();
        panel_Right_Water = new JPanel();
        slider_Right_Water = new JSlider();
        text_Right_Water = new JTextField();
        panel_Right_Power = new JPanel();
        slider_Right_Power = new JSlider();
        text_Right_Power = new JTextField();
        tab_Attributes = new JPanel();
        panel_MotorStrength = new JPanel();
        slider_MotorStrength = new JSlider();
        text_MotorStrength = new JTextField();
        panel_Aggression = new JPanel();
        slider_Aggression = new JSlider();
        text_Aggression = new JTextField();
        panel_BatteryCapacity = new JPanel();
        label_MaxBattery = new JLabel();
        slider_MaxBattery = new JSlider();
        text_MaxBattery = new JTextField();
        label_CurrentBattery = new JLabel();
        slider_CurrentBattery = new JSlider();
        text_CurrentBattery = new JTextField();
        panel_Memory = new JPanel();
        label_MemMaxCapacity = new JLabel();
        slider_MemMaxCapacity = new JSlider();
        text_MemMaxCapacity = new JTextField();
        label_MemLearnRate = new JLabel();
        slider_MemLearnRate = new JSlider();
        text_MemLearnRate = new JTextField();
        text_Status = new JTextField();
        button_Save = new JButton();
        button_SaveAsNew = new JButton();
        button_Cancel = new JButton();

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        ResourceMap resourceMap = Application.getInstance(VehiclesApp.class).getContext().getResourceMap(VehicleEditor.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setMinimumSize(new Dimension(620, 560));
        setName("Form"); // NOI18N
        addWindowFocusListener(new WindowFocusListener() {
            public void windowGainedFocus(WindowEvent evt) {
                formWindowGainedFocus(evt);
            }
            public void windowLostFocus(WindowEvent evt) {
            }
        });

        panel_SelectedVehicle.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_SelectedVehicle.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_SelectedVehicle.border.titleFont"))); // NOI18N
        panel_SelectedVehicle.setName("panel_SelectedVehicle"); // NOI18N

        dropdown_SelectedVehicle.setMaximumRowCount(4);
        dropdown_SelectedVehicle.setModel(vehiclesDropDown);
        dropdown_SelectedVehicle.setName("dropdown_SelectedVehicle"); // NOI18N
        dropdown_SelectedVehicle.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
                dropdown_SelectedVehicleItemStateChanged(evt);
            }
        });

        GroupLayout panel_SelectedVehicleLayout = new GroupLayout(panel_SelectedVehicle);
        panel_SelectedVehicle.setLayout(panel_SelectedVehicleLayout);
        panel_SelectedVehicleLayout.setHorizontalGroup(
            panel_SelectedVehicleLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(dropdown_SelectedVehicle, 0, 588, Short.MAX_VALUE)
        );
        panel_SelectedVehicleLayout.setVerticalGroup(
            panel_SelectedVehicleLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(dropdown_SelectedVehicle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        tabContainer.setName("tabContainer"); // NOI18N

        tab_Properties.setName("tab_Properties"); // NOI18N
        tab_Properties.addFocusListener(new FocusAdapter() {
            public void focusGained(FocusEvent evt) {
                tab_PropertiesFocusGained(evt);
            }
            public void focusLost(FocusEvent evt) {
                tab_PropertiesFocusLost(evt);
            }
        });

        panel_Name.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Name.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Name.border.titleFont"))); // NOI18N
        panel_Name.setName("panel_Name"); // NOI18N
        panel_Name.setPreferredSize(new Dimension(224, 46));

        text_Name.setName("text_Name"); // NOI18N

        GroupLayout panel_NameLayout = new GroupLayout(panel_Name);
        panel_Name.setLayout(panel_NameLayout);
        panel_NameLayout.setHorizontalGroup(
            panel_NameLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Name, GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)
        );
        panel_NameLayout.setVerticalGroup(
            panel_NameLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Name, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        panel_Author.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Author.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Author.border.titleFont"))); // NOI18N
        panel_Author.setName("panel_Author"); // NOI18N

        text_Author.setName("text_Author"); // NOI18N

        GroupLayout panel_AuthorLayout = new GroupLayout(panel_Author);
        panel_Author.setLayout(panel_AuthorLayout);
        panel_AuthorLayout.setHorizontalGroup(
            panel_AuthorLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Author, GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)
        );
        panel_AuthorLayout.setVerticalGroup(
            panel_AuthorLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Author, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        panel_Description.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Description.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Description.border.titleFont"))); // NOI18N
        panel_Description.setName("panel_Description"); // NOI18N
        panel_Description.setPreferredSize(new Dimension(220, 311));

        scrollpanel_Description.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollpanel_Description.setAutoscrolls(true);
        scrollpanel_Description.setName("scrollpanel_Description"); // NOI18N

        text_Description.setColumns(20);
        text_Description.setFont(resourceMap.getFont("text_Description.font")); // NOI18N
        text_Description.setLineWrap(true);
        text_Description.setRows(5);
        text_Description.setWrapStyleWord(true);
        text_Description.setName("text_Description"); // NOI18N
        scrollpanel_Description.setViewportView(text_Description);

        GroupLayout panel_DescriptionLayout = new GroupLayout(panel_Description);
        panel_Description.setLayout(panel_DescriptionLayout);
        panel_DescriptionLayout.setHorizontalGroup(
            panel_DescriptionLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_Description, GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)
        );
        panel_DescriptionLayout.setVerticalGroup(
            panel_DescriptionLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_Description, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
        );

        panel_LastModified.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_LastModified.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_LastModified.border.titleFont"))); // NOI18N
        panel_LastModified.setName("panel_LastModified"); // NOI18N

        text_LastModified.setEditable(false);
        text_LastModified.setBorder(BorderFactory.createEmptyBorder(1, 4, 1, 1));
        text_LastModified.setName("text_LastModified"); // NOI18N

        GroupLayout panel_LastModifiedLayout = new GroupLayout(panel_LastModified);
        panel_LastModified.setLayout(panel_LastModifiedLayout);
        panel_LastModifiedLayout.setHorizontalGroup(
            panel_LastModifiedLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_LastModified, GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE)
        );
        panel_LastModifiedLayout.setVerticalGroup(
            panel_LastModifiedLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_LastModified, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        panel_Appearance.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Appearance.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Appearance.border.titleFont"))); // NOI18N
        panel_Appearance.setName("panel_Appearance"); // NOI18N
        panel_Appearance.setPreferredSize(new Dimension(220, 311));

        processing_Appearance.setBackground(resourceMap.getColor("processing_Appearance.background")); // NOI18N
        processing_Appearance.setName("processing_Appearance"); // NOI18N
        processing_Appearance.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent evt) {
                processing_AppearanceComponentResized(evt);
            }
        });
        processing_Appearance.setLayout(new BorderLayout());

        panel_Blue.setBorder(BorderFactory.createTitledBorder(resourceMap.getString("panel_Blue.border.title"))); // NOI18N
        panel_Blue.setName("panel_Blue"); // NOI18N

        slider_Blue.setMaximum(255);
        slider_Blue.setValue(128);
        slider_Blue.setName("slider_Blue"); // NOI18N
        slider_Blue.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Blue_StateChanged(evt);
            }
        });

        text_Blue.setEditable(false);
        text_Blue.setFont(resourceMap.getFont("text_Blue.font")); // NOI18N
        text_Blue.setText(resourceMap.getString("text_Blue.text")); // NOI18N
        text_Blue.setName("text_Blue"); // NOI18N

        GroupLayout panel_BlueLayout = new GroupLayout(panel_Blue);
        panel_Blue.setLayout(panel_BlueLayout);
        panel_BlueLayout.setHorizontalGroup(
            panel_BlueLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_BlueLayout.createSequentialGroup()
                .addComponent(slider_Blue, GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Blue, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
        );
        panel_BlueLayout.setVerticalGroup(
            panel_BlueLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Blue, GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
            .addComponent(slider_Blue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        panel_Green.setBorder(BorderFactory.createTitledBorder(resourceMap.getString("panel_Green.border.title"))); // NOI18N
        panel_Green.setName("panel_Green"); // NOI18N

        slider_Green.setMaximum(255);
        slider_Green.setValue(128);
        slider_Green.setName("slider_Green"); // NOI18N
        slider_Green.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Green_StateChanged(evt);
            }
        });

        text_Green.setEditable(false);
        text_Green.setFont(resourceMap.getFont("text_Green.font")); // NOI18N
        text_Green.setText(resourceMap.getString("text_Green.text")); // NOI18N
        text_Green.setName("text_Green"); // NOI18N

        GroupLayout panel_GreenLayout = new GroupLayout(panel_Green);
        panel_Green.setLayout(panel_GreenLayout);
        panel_GreenLayout.setHorizontalGroup(
            panel_GreenLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_GreenLayout.createSequentialGroup()
                .addComponent(slider_Green, GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Green, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
        );
        panel_GreenLayout.setVerticalGroup(
            panel_GreenLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Green, GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
            .addComponent(slider_Green, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        panel_Red.setBorder(BorderFactory.createTitledBorder(resourceMap.getString("panel_Red.border.title"))); // NOI18N
        panel_Red.setName("panel_Red"); // NOI18N

        slider_Red.setMaximum(255);
        slider_Red.setValue(128);
        slider_Red.setName("slider_Red"); // NOI18N
        slider_Red.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Red_StateChanged(evt);
            }
        });

        text_Red.setEditable(false);
        text_Red.setFont(resourceMap.getFont("text_Red.font")); // NOI18N
        text_Red.setText(resourceMap.getString("text_Red.text")); // NOI18N
        text_Red.setName("text_Red"); // NOI18N

        GroupLayout panel_RedLayout = new GroupLayout(panel_Red);
        panel_Red.setLayout(panel_RedLayout);
        panel_RedLayout.setHorizontalGroup(
            panel_RedLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_RedLayout.createSequentialGroup()
                .addComponent(slider_Red, GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Red, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
        );
        panel_RedLayout.setVerticalGroup(
            panel_RedLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Red, GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE)
            .addComponent(slider_Red, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        GroupLayout panel_AppearanceLayout = new GroupLayout(panel_Appearance);
        panel_Appearance.setLayout(panel_AppearanceLayout);
        panel_AppearanceLayout.setHorizontalGroup(
            panel_AppearanceLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(panel_Red, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Green, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Blue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(processing_Appearance, GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
        );
        panel_AppearanceLayout.setVerticalGroup(
            panel_AppearanceLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_AppearanceLayout.createSequentialGroup()
                .addComponent(processing_Appearance, GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Red, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Green, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Blue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        processing_Appearance.add(proVehiclePreview,BorderLayout.CENTER);

        GroupLayout tab_PropertiesLayout = new GroupLayout(tab_Properties);
        tab_Properties.setLayout(tab_PropertiesLayout);
        tab_PropertiesLayout.setHorizontalGroup(
            tab_PropertiesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(tab_PropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_PropertiesLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_Description, GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE)
                    .addComponent(panel_Name, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE)
                    .addComponent(panel_Author, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_LastModified, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Appearance, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
                .addContainerGap())
        );
        tab_PropertiesLayout.setVerticalGroup(
            tab_PropertiesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, tab_PropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_PropertiesLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_Appearance, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                    .addGroup(Alignment.LEADING, tab_PropertiesLayout.createSequentialGroup()
                        .addComponent(panel_Name, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(panel_Author, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(panel_Description, GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(panel_LastModified, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        tabContainer.addTab("Properties", tab_Properties);

        tab_Design.setName("tab_Design"); // NOI18N

        panel_LeftSensor.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_LeftSensor.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_LeftSensor.border.titleFont"))); // NOI18N
        panel_LeftSensor.setName("panel_LeftSensor"); // NOI18N

        panel_Left_Light.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Left_Light.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Left_Light.setName("panel_Left_Light"); // NOI18N

        slider_Left_Light.setMajorTickSpacing(10);
        slider_Left_Light.setMaximum(50);
        slider_Left_Light.setMinimum(-50);
        slider_Left_Light.setMinorTickSpacing(2);
        slider_Left_Light.setOrientation(JSlider.VERTICAL);
        slider_Left_Light.setPaintLabels(true);
        slider_Left_Light.setPaintTicks(true);
        slider_Left_Light.setValue(0);
        slider_Left_Light.setName("slider_Left_Light"); // NOI18N
        slider_Left_Light.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Left_Light_StateChanged(evt);
            }
        });

        text_Left_Light.setEditable(false);
        text_Left_Light.setFont(resourceMap.getFont("text_Left_Light.font")); // NOI18N
        text_Left_Light.setHorizontalAlignment(JTextField.CENTER);
        text_Left_Light.setText(resourceMap.getString("text_Left_Light.text")); // NOI18N
        text_Left_Light.setName("text_Left_Light"); // NOI18N

        GroupLayout panel_Left_LightLayout = new GroupLayout(panel_Left_Light);
        panel_Left_Light.setLayout(panel_Left_LightLayout);
        panel_Left_LightLayout.setHorizontalGroup(
            panel_Left_LightLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Left_Light, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
            .addComponent(slider_Left_Light, GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
        );
        panel_Left_LightLayout.setVerticalGroup(
            panel_Left_LightLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Left_LightLayout.createSequentialGroup()
                .addComponent(slider_Left_Light, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Left_Light, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        panel_Left_Heat.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Left_Heat.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Left_Heat.setName("panel_Left_Heat"); // NOI18N

        slider_Left_Heat.setMajorTickSpacing(10);
        slider_Left_Heat.setMaximum(50);
        slider_Left_Heat.setMinimum(-50);
        slider_Left_Heat.setMinorTickSpacing(2);
        slider_Left_Heat.setOrientation(JSlider.VERTICAL);
        slider_Left_Heat.setPaintLabels(true);
        slider_Left_Heat.setPaintTicks(true);
        slider_Left_Heat.setValue(0);
        slider_Left_Heat.setName("slider_Left_Heat"); // NOI18N
        slider_Left_Heat.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Left_Heat_StateChanged(evt);
            }
        });

        text_Left_Heat.setEditable(false);
        text_Left_Heat.setFont(resourceMap.getFont("text_Left_Heat.font")); // NOI18N
        text_Left_Heat.setHorizontalAlignment(JTextField.CENTER);
        text_Left_Heat.setText(resourceMap.getString("text_Left_Heat.text")); // NOI18N
        text_Left_Heat.setName("text_Left_Heat"); // NOI18N

        GroupLayout panel_Left_HeatLayout = new GroupLayout(panel_Left_Heat);
        panel_Left_Heat.setLayout(panel_Left_HeatLayout);
        panel_Left_HeatLayout.setHorizontalGroup(
            panel_Left_HeatLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Left_Heat, GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
            .addComponent(slider_Left_Heat, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
        );
        panel_Left_HeatLayout.setVerticalGroup(
            panel_Left_HeatLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Left_HeatLayout.createSequentialGroup()
                .addComponent(slider_Left_Heat, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Left_Heat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        panel_Left_Water.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Left_Water.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Left_Water.setName("panel_Left_Water"); // NOI18N

        slider_Left_Water.setMajorTickSpacing(10);
        slider_Left_Water.setMaximum(50);
        slider_Left_Water.setMinimum(-50);
        slider_Left_Water.setMinorTickSpacing(2);
        slider_Left_Water.setOrientation(JSlider.VERTICAL);
        slider_Left_Water.setPaintLabels(true);
        slider_Left_Water.setPaintTicks(true);
        slider_Left_Water.setValue(0);
        slider_Left_Water.setName("slider_Left_Water"); // NOI18N
        slider_Left_Water.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Left_Water_StateChanged(evt);
            }
        });

        text_Left_Water.setEditable(false);
        text_Left_Water.setFont(resourceMap.getFont("text_Left_Water.font")); // NOI18N
        text_Left_Water.setHorizontalAlignment(JTextField.CENTER);
        text_Left_Water.setText(resourceMap.getString("text_Left_Water.text")); // NOI18N
        text_Left_Water.setName("text_Left_Water"); // NOI18N

        GroupLayout panel_Left_WaterLayout = new GroupLayout(panel_Left_Water);
        panel_Left_Water.setLayout(panel_Left_WaterLayout);
        panel_Left_WaterLayout.setHorizontalGroup(
            panel_Left_WaterLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Left_Water, GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
            .addComponent(slider_Left_Water, GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
        );
        panel_Left_WaterLayout.setVerticalGroup(
            panel_Left_WaterLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Left_WaterLayout.createSequentialGroup()
                .addComponent(slider_Left_Water, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Left_Water, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        panel_Left_Power.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Left_Power.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Left_Power.setName("panel_Left_Power"); // NOI18N

        slider_Left_Power.setMajorTickSpacing(10);
        slider_Left_Power.setMaximum(50);
        slider_Left_Power.setMinimum(-50);
        slider_Left_Power.setMinorTickSpacing(2);
        slider_Left_Power.setOrientation(JSlider.VERTICAL);
        slider_Left_Power.setPaintLabels(true);
        slider_Left_Power.setPaintTicks(true);
        slider_Left_Power.setValue(0);
        slider_Left_Power.setName("slider_Left_Power"); // NOI18N
        slider_Left_Power.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Left_Power_StateChanged(evt);
            }
        });

        text_Left_Power.setEditable(false);
        text_Left_Power.setFont(resourceMap.getFont("text_Left_Power.font")); // NOI18N
        text_Left_Power.setHorizontalAlignment(JTextField.CENTER);
        text_Left_Power.setText(resourceMap.getString("text_Left_Power.text")); // NOI18N
        text_Left_Power.setName("text_Left_Power"); // NOI18N

        GroupLayout panel_Left_PowerLayout = new GroupLayout(panel_Left_Power);
        panel_Left_Power.setLayout(panel_Left_PowerLayout);
        panel_Left_PowerLayout.setHorizontalGroup(
            panel_Left_PowerLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Left_Power, GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE)
            .addComponent(slider_Left_Power, GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE)
        );
        panel_Left_PowerLayout.setVerticalGroup(
            panel_Left_PowerLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Left_PowerLayout.createSequentialGroup()
                .addComponent(slider_Left_Power, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Left_Power, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        GroupLayout panel_LeftSensorLayout = new GroupLayout(panel_LeftSensor);
        panel_LeftSensor.setLayout(panel_LeftSensorLayout);
        panel_LeftSensorLayout.setHorizontalGroup(
            panel_LeftSensorLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_LeftSensorLayout.createSequentialGroup()
                .addComponent(panel_Left_Light, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Left_Heat, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Left_Water, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Left_Power, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panel_LeftSensorLayout.setVerticalGroup(
            panel_LeftSensorLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(panel_Left_Light, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Left_Heat, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Left_Water, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Left_Power, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        panel_RightSensor.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_RightSensor.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_RightSensor.border.titleFont"))); // NOI18N
        panel_RightSensor.setName("panel_RightSensor"); // NOI18N

        panel_Right_Light.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Right_Light.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Right_Light.setName("panel_Right_Light"); // NOI18N

        slider_Right_Light.setMajorTickSpacing(10);
        slider_Right_Light.setMaximum(50);
        slider_Right_Light.setMinimum(-50);
        slider_Right_Light.setMinorTickSpacing(2);
        slider_Right_Light.setOrientation(JSlider.VERTICAL);
        slider_Right_Light.setPaintLabels(true);
        slider_Right_Light.setPaintTicks(true);
        slider_Right_Light.setValue(0);
        slider_Right_Light.setName("slider_Right_Light"); // NOI18N
        slider_Right_Light.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Right_Light_StateChanged(evt);
            }
        });

        text_Right_Light.setEditable(false);
        text_Right_Light.setFont(resourceMap.getFont("text_Right_Light.font")); // NOI18N
        text_Right_Light.setHorizontalAlignment(JTextField.CENTER);
        text_Right_Light.setText(resourceMap.getString("text_Right_Light.text")); // NOI18N
        text_Right_Light.setName("text_Right_Light"); // NOI18N

        GroupLayout panel_Right_LightLayout = new GroupLayout(panel_Right_Light);
        panel_Right_Light.setLayout(panel_Right_LightLayout);
        panel_Right_LightLayout.setHorizontalGroup(
            panel_Right_LightLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Right_Light, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)
            .addComponent(slider_Right_Light, GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)
        );
        panel_Right_LightLayout.setVerticalGroup(
            panel_Right_LightLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Right_LightLayout.createSequentialGroup()
                .addComponent(slider_Right_Light, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Right_Light, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        panel_Right_Heat.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Right_Heat.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Right_Heat.setName("panel_Right_Heat"); // NOI18N

        slider_Right_Heat.setMajorTickSpacing(10);
        slider_Right_Heat.setMaximum(50);
        slider_Right_Heat.setMinimum(-50);
        slider_Right_Heat.setMinorTickSpacing(2);
        slider_Right_Heat.setOrientation(JSlider.VERTICAL);
        slider_Right_Heat.setPaintLabels(true);
        slider_Right_Heat.setPaintTicks(true);
        slider_Right_Heat.setValue(0);
        slider_Right_Heat.setName("slider_Right_Heat"); // NOI18N
        slider_Right_Heat.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Right_Heat_StateChanged(evt);
            }
        });

        text_Right_Heat.setEditable(false);
        text_Right_Heat.setFont(resourceMap.getFont("text_Right_Heat.font")); // NOI18N
        text_Right_Heat.setHorizontalAlignment(JTextField.CENTER);
        text_Right_Heat.setText(resourceMap.getString("text_Right_Heat.text")); // NOI18N
        text_Right_Heat.setName("text_Right_Heat"); // NOI18N

        GroupLayout panel_Right_HeatLayout = new GroupLayout(panel_Right_Heat);
        panel_Right_Heat.setLayout(panel_Right_HeatLayout);
        panel_Right_HeatLayout.setHorizontalGroup(
            panel_Right_HeatLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Right_Heat, GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
            .addComponent(slider_Right_Heat, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
        );
        panel_Right_HeatLayout.setVerticalGroup(
            panel_Right_HeatLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Right_HeatLayout.createSequentialGroup()
                .addComponent(slider_Right_Heat, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Right_Heat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        panel_Right_Water.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Right_Water.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Right_Water.setName("panel_Right_Water"); // NOI18N

        slider_Right_Water.setMajorTickSpacing(10);
        slider_Right_Water.setMaximum(50);
        slider_Right_Water.setMinimum(-50);
        slider_Right_Water.setMinorTickSpacing(2);
        slider_Right_Water.setOrientation(JSlider.VERTICAL);
        slider_Right_Water.setPaintLabels(true);
        slider_Right_Water.setPaintTicks(true);
        slider_Right_Water.setValue(0);
        slider_Right_Water.setName("slider_Right_Water"); // NOI18N
        slider_Right_Water.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Right_Water_StateChanged(evt);
            }
        });

        text_Right_Water.setEditable(false);
        text_Right_Water.setFont(resourceMap.getFont("text_Right_Water.font")); // NOI18N
        text_Right_Water.setHorizontalAlignment(JTextField.CENTER);
        text_Right_Water.setText(resourceMap.getString("text_Right_Water.text")); // NOI18N
        text_Right_Water.setName("text_Right_Water"); // NOI18N

        GroupLayout panel_Right_WaterLayout = new GroupLayout(panel_Right_Water);
        panel_Right_Water.setLayout(panel_Right_WaterLayout);
        panel_Right_WaterLayout.setHorizontalGroup(
            panel_Right_WaterLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Right_Water, GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
            .addComponent(slider_Right_Water, GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
        );
        panel_Right_WaterLayout.setVerticalGroup(
            panel_Right_WaterLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Right_WaterLayout.createSequentialGroup()
                .addComponent(slider_Right_Water, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Right_Water, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        panel_Right_Power.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1), resourceMap.getString("panel_Right_Power.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION)); // NOI18N
        panel_Right_Power.setName("panel_Right_Power"); // NOI18N

        slider_Right_Power.setMajorTickSpacing(10);
        slider_Right_Power.setMaximum(50);
        slider_Right_Power.setMinimum(-50);
        slider_Right_Power.setMinorTickSpacing(2);
        slider_Right_Power.setOrientation(JSlider.VERTICAL);
        slider_Right_Power.setPaintLabels(true);
        slider_Right_Power.setPaintTicks(true);
        slider_Right_Power.setValue(0);
        slider_Right_Power.setName("slider_Right_Power"); // NOI18N
        slider_Right_Power.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Right_Power_StateChanged(evt);
            }
        });

        text_Right_Power.setEditable(false);
        text_Right_Power.setFont(resourceMap.getFont("text_Right_Power.font")); // NOI18N
        text_Right_Power.setHorizontalAlignment(JTextField.CENTER);
        text_Right_Power.setText(resourceMap.getString("text_Right_Power.text")); // NOI18N
        text_Right_Power.setName("text_Right_Power"); // NOI18N

        GroupLayout panel_Right_PowerLayout = new GroupLayout(panel_Right_Power);
        panel_Right_Power.setLayout(panel_Right_PowerLayout);
        panel_Right_PowerLayout.setHorizontalGroup(
            panel_Right_PowerLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Right_Power, GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
            .addComponent(slider_Right_Power, GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
        );
        panel_Right_PowerLayout.setVerticalGroup(
            panel_Right_PowerLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_Right_PowerLayout.createSequentialGroup()
                .addComponent(slider_Right_Power, GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Right_Power, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        );

        GroupLayout panel_RightSensorLayout = new GroupLayout(panel_RightSensor);
        panel_RightSensor.setLayout(panel_RightSensorLayout);
        panel_RightSensorLayout.setHorizontalGroup(
            panel_RightSensorLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_RightSensorLayout.createSequentialGroup()
                .addComponent(panel_Right_Light, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Right_Heat, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Right_Water, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Right_Power, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panel_RightSensorLayout.setVerticalGroup(
            panel_RightSensorLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(panel_Right_Light, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Right_Heat, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Right_Water, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panel_Right_Power, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        GroupLayout tab_DesignLayout = new GroupLayout(tab_Design);
        tab_Design.setLayout(tab_DesignLayout);
        tab_DesignLayout.setHorizontalGroup(
            tab_DesignLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, tab_DesignLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_DesignLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_RightSensor, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_LeftSensor, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        tab_DesignLayout.setVerticalGroup(
            tab_DesignLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(tab_DesignLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panel_LeftSensor, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_RightSensor, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        panel_LeftSensor.getAccessibleContext().setAccessibleName(resourceMap.getString("jPanel6.AccessibleContext.accessibleName")); // NOI18N

        tabContainer.addTab(resourceMap.getString("tab_Design.TabConstraints.tabTitle"), tab_Design); // NOI18N

        tab_Attributes.setName("tab_Attributes"); // NOI18N

        panel_MotorStrength.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_MotorStrength.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_MotorStrength.border.titleFont"))); // NOI18N
        panel_MotorStrength.setToolTipText(resourceMap.getString("panel_MotorStrength.toolTipText")); // NOI18N
        panel_MotorStrength.setMinimumSize(new Dimension(100, 0));
        panel_MotorStrength.setName("panel_MotorStrength"); // NOI18N

        slider_MotorStrength.setMajorTickSpacing(10);
        slider_MotorStrength.setMinorTickSpacing(2);
        slider_MotorStrength.setOrientation(JSlider.VERTICAL);
        slider_MotorStrength.setPaintLabels(true);
        slider_MotorStrength.setPaintTicks(true);
        slider_MotorStrength.setName("slider_MotorStrength"); // NOI18N
        slider_MotorStrength.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_MotorStrength_StateChanged(evt);
            }
        });

        text_MotorStrength.setEditable(false);
        text_MotorStrength.setFont(resourceMap.getFont("text_MotorStrength.font")); // NOI18N
        text_MotorStrength.setHorizontalAlignment(JTextField.CENTER);
        text_MotorStrength.setText(resourceMap.getString("text_MotorStrength.text")); // NOI18N
        text_MotorStrength.setName("text_MotorStrength"); // NOI18N

        GroupLayout panel_MotorStrengthLayout = new GroupLayout(panel_MotorStrength);
        panel_MotorStrength.setLayout(panel_MotorStrengthLayout);
        panel_MotorStrengthLayout.setHorizontalGroup(
            panel_MotorStrengthLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_MotorStrength, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
            .addGroup(panel_MotorStrengthLayout.createSequentialGroup()
                .addComponent(slider_MotorStrength, GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
                .addContainerGap())
        );
        panel_MotorStrengthLayout.setVerticalGroup(
            panel_MotorStrengthLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_MotorStrengthLayout.createSequentialGroup()
                .addComponent(slider_MotorStrength, GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_MotorStrength, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
        );

        panel_Aggression.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Aggression.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Aggression.border.titleFont"))); // NOI18N
        panel_Aggression.setMinimumSize(new Dimension(76, 0));
        panel_Aggression.setName("panel_Aggression"); // NOI18N

        slider_Aggression.setMajorTickSpacing(10);
        slider_Aggression.setMinorTickSpacing(2);
        slider_Aggression.setOrientation(JSlider.VERTICAL);
        slider_Aggression.setPaintLabels(true);
        slider_Aggression.setPaintTicks(true);
        slider_Aggression.setName("slider_Aggression"); // NOI18N
        slider_Aggression.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_Aggression_StateChanged(evt);
            }
        });

        text_Aggression.setEditable(false);
        text_Aggression.setFont(resourceMap.getFont("text_Aggression.font")); // NOI18N
        text_Aggression.setHorizontalAlignment(JTextField.CENTER);
        text_Aggression.setText(resourceMap.getString("text_Aggression.text")); // NOI18N
        text_Aggression.setName("text_Aggression"); // NOI18N

        GroupLayout panel_AggressionLayout = new GroupLayout(panel_Aggression);
        panel_Aggression.setLayout(panel_AggressionLayout);
        panel_AggressionLayout.setHorizontalGroup(
            panel_AggressionLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Aggression, GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)
            .addGroup(panel_AggressionLayout.createSequentialGroup()
                .addComponent(slider_Aggression, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
                .addGap(10, 10, 10))
        );
        panel_AggressionLayout.setVerticalGroup(
            panel_AggressionLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_AggressionLayout.createSequentialGroup()
                .addComponent(slider_Aggression, GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(text_Aggression, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
        );

        panel_BatteryCapacity.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_BatteryCapacity.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_BatteryCapacity.border.titleFont"))); // NOI18N
        panel_BatteryCapacity.setToolTipText(resourceMap.getString("panel_BatteryCapacity.toolTipText")); // NOI18N
        panel_BatteryCapacity.setMinimumSize(new Dimension(114, 0));
        panel_BatteryCapacity.setName("panel_BatteryCapacity"); // NOI18N

        label_MaxBattery.setHorizontalAlignment(SwingConstants.CENTER);
        label_MaxBattery.setText(resourceMap.getString("label_MaxBattery.text")); // NOI18N
        label_MaxBattery.setName("label_MaxBattery"); // NOI18N

        slider_MaxBattery.setMajorTickSpacing(10);
        slider_MaxBattery.setMinimum(10);
        slider_MaxBattery.setMinorTickSpacing(2);
        slider_MaxBattery.setOrientation(JSlider.VERTICAL);
        slider_MaxBattery.setPaintLabels(true);
        slider_MaxBattery.setPaintTicks(true);
        slider_MaxBattery.setName("slider_MaxBattery"); // NOI18N
        slider_MaxBattery.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_MaxBattery_StateChanged(evt);
            }
        });

        text_MaxBattery.setEditable(false);
        text_MaxBattery.setFont(resourceMap.getFont("text_MaxBattery.font")); // NOI18N
        text_MaxBattery.setHorizontalAlignment(JTextField.CENTER);
        text_MaxBattery.setText(resourceMap.getString("text_MaxBattery.text")); // NOI18N
        text_MaxBattery.setName("text_MaxBattery"); // NOI18N

        label_CurrentBattery.setHorizontalAlignment(SwingConstants.CENTER);
        label_CurrentBattery.setText(resourceMap.getString("label_CurrentBattery.text")); // NOI18N
        label_CurrentBattery.setName("label_CurrentBattery"); // NOI18N

        slider_CurrentBattery.setMajorTickSpacing(10);
        slider_CurrentBattery.setMinimum(10);
        slider_CurrentBattery.setMinorTickSpacing(2);
        slider_CurrentBattery.setOrientation(JSlider.VERTICAL);
        slider_CurrentBattery.setPaintLabels(true);
        slider_CurrentBattery.setPaintTicks(true);
        slider_CurrentBattery.setName("slider_CurrentBattery"); // NOI18N
        slider_CurrentBattery.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_CurrentBattery_StateChanged(evt);
            }
        });

        text_CurrentBattery.setEditable(false);
        text_CurrentBattery.setFont(resourceMap.getFont("text_CurrentBattery.font")); // NOI18N
        text_CurrentBattery.setHorizontalAlignment(JTextField.CENTER);
        text_CurrentBattery.setText(resourceMap.getString("text_CurrentBattery.text")); // NOI18N
        text_CurrentBattery.setName("text_CurrentBattery"); // NOI18N

        GroupLayout panel_BatteryCapacityLayout = new GroupLayout(panel_BatteryCapacity);
        panel_BatteryCapacity.setLayout(panel_BatteryCapacityLayout);
        panel_BatteryCapacityLayout.setHorizontalGroup(
            panel_BatteryCapacityLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_BatteryCapacityLayout.createSequentialGroup()
                .addGroup(panel_BatteryCapacityLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(text_MaxBattery, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
                    .addComponent(slider_MaxBattery, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
                    .addComponent(label_MaxBattery, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(panel_BatteryCapacityLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(text_CurrentBattery, GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                    .addComponent(slider_CurrentBattery, GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                    .addComponent(label_CurrentBattery, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)))
        );
        panel_BatteryCapacityLayout.setVerticalGroup(
            panel_BatteryCapacityLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_BatteryCapacityLayout.createSequentialGroup()
                .addGroup(panel_BatteryCapacityLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(label_MaxBattery)
                    .addComponent(label_CurrentBattery))
                .addGap(6, 6, 6)
                .addGroup(panel_BatteryCapacityLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(slider_CurrentBattery, GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE)
                    .addComponent(slider_MaxBattery, GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(panel_BatteryCapacityLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(text_MaxBattery, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
                    .addComponent(text_CurrentBattery, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)))
        );

        panel_Memory.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Memory.border.title"), TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Memory.border.titleFont"))); // NOI18N
        panel_Memory.setToolTipText(resourceMap.getString("panel_Memory.toolTipText")); // NOI18N
        panel_Memory.setMinimumSize(new Dimension(114, 0));
        panel_Memory.setName("panel_Memory"); // NOI18N

        label_MemMaxCapacity.setHorizontalAlignment(SwingConstants.CENTER);
        label_MemMaxCapacity.setText(resourceMap.getString("label_MemMaxCapacity.text")); // NOI18N
        label_MemMaxCapacity.setName("label_MemMaxCapacity"); // NOI18N

        slider_MemMaxCapacity.setMajorTickSpacing(10);
        slider_MemMaxCapacity.setMinorTickSpacing(2);
        slider_MemMaxCapacity.setOrientation(JSlider.VERTICAL);
        slider_MemMaxCapacity.setPaintLabels(true);
        slider_MemMaxCapacity.setPaintTicks(true);
        slider_MemMaxCapacity.setName("slider_MemMaxCapacity"); // NOI18N
        slider_MemMaxCapacity.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_MemMaxCapacity_StateChanged(evt);
            }
        });

        text_MemMaxCapacity.setEditable(false);
        text_MemMaxCapacity.setFont(resourceMap.getFont("text_MemMaxCapacity.font")); // NOI18N
        text_MemMaxCapacity.setHorizontalAlignment(JTextField.CENTER);
        text_MemMaxCapacity.setText(resourceMap.getString("text_MemMaxCapacity.text")); // NOI18N
        text_MemMaxCapacity.setName("text_MemMaxCapacity"); // NOI18N

        label_MemLearnRate.setHorizontalAlignment(SwingConstants.CENTER);
        label_MemLearnRate.setText(resourceMap.getString("label_MemLearnRate.text")); // NOI18N
        label_MemLearnRate.setName("label_MemLearnRate"); // NOI18N

        slider_MemLearnRate.setMajorTickSpacing(10);
        slider_MemLearnRate.setMaximum(20);
        slider_MemLearnRate.setMinorTickSpacing(1);
        slider_MemLearnRate.setOrientation(JSlider.VERTICAL);
        slider_MemLearnRate.setPaintLabels(true);
        slider_MemLearnRate.setPaintTicks(true);
        slider_MemLearnRate.setValue(10);
        slider_MemLearnRate.setName("slider_MemLearnRate"); // NOI18N
        slider_MemLearnRate.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                slider_MemLearnRate_StateChanged(evt);
            }
        });

        text_MemLearnRate.setEditable(false);
        text_MemLearnRate.setFont(resourceMap.getFont("text_MemLearnRate.font")); // NOI18N
        text_MemLearnRate.setHorizontalAlignment(JTextField.CENTER);
        text_MemLearnRate.setText(resourceMap.getString("text_MemLearnRate.text")); // NOI18N
        text_MemLearnRate.setName("text_MemLearnRate"); // NOI18N

        GroupLayout panel_MemoryLayout = new GroupLayout(panel_Memory);
        panel_Memory.setLayout(panel_MemoryLayout);
        panel_MemoryLayout.setHorizontalGroup(
            panel_MemoryLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_MemoryLayout.createSequentialGroup()
                .addGroup(panel_MemoryLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(text_MemMaxCapacity, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
                    .addComponent(slider_MemMaxCapacity, GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
                    .addComponent(label_MemMaxCapacity, GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(panel_MemoryLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(text_MemLearnRate, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
                    .addComponent(slider_MemLearnRate, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
                    .addComponent(label_MemLearnRate, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)))
        );
        panel_MemoryLayout.setVerticalGroup(
            panel_MemoryLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_MemoryLayout.createSequentialGroup()
                .addGroup(panel_MemoryLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(label_MemMaxCapacity)
                    .addComponent(label_MemLearnRate))
                .addGap(6, 6, 6)
                .addGroup(panel_MemoryLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(slider_MemLearnRate, GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE)
                    .addComponent(slider_MemMaxCapacity, GroupLayout.DEFAULT_SIZE, 331, Short.MAX_VALUE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(panel_MemoryLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(text_MemMaxCapacity, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
                    .addComponent(text_MemLearnRate, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)))
        );

        GroupLayout tab_AttributesLayout = new GroupLayout(tab_Attributes);
        tab_Attributes.setLayout(tab_AttributesLayout);
        tab_AttributesLayout.setHorizontalGroup(
            tab_AttributesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(tab_AttributesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panel_MotorStrength, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Aggression, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_BatteryCapacity, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Memory, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        tab_AttributesLayout.setVerticalGroup(
            tab_AttributesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, tab_AttributesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_AttributesLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_Memory, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_BatteryCapacity, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_Aggression, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_MotorStrength, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        tabContainer.addTab(resourceMap.getString("tab_Attributes.TabConstraints.tabTitle"), tab_Attributes); // NOI18N

        text_Status.setEditable(false);
        text_Status.setText(resourceMap.getString("text_Status.text")); // NOI18N
        text_Status.setName("text_Status"); // NOI18N

        ActionMap actionMap = Application.getInstance(VehiclesApp.class).getContext().getActionMap(VehicleEditor.class, this);
        button_Save.setAction(actionMap.get("saveVehicle")); // NOI18N
        button_Save.setText(resourceMap.getString("button_Save.text")); // NOI18N
        button_Save.setName("button_Save"); // NOI18N

        button_SaveAsNew.setAction(actionMap.get("saveVehicleAs")); // NOI18N
        button_SaveAsNew.setText(resourceMap.getString("button_SaveAsNew.text")); // NOI18N
        button_SaveAsNew.setName("button_SaveAsNew"); // NOI18N

        button_Cancel.setAction(actionMap.get("cancel")); // NOI18N
        button_Cancel.setText(resourceMap.getString("button_Cancel.text")); // NOI18N
        button_Cancel.setName("button_Cancel"); // NOI18N

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_SelectedVehicle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tabContainer, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(text_Status, GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(button_Save)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(button_SaveAsNew)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(button_Cancel)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panel_SelectedVehicle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(tabContainer, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(button_Cancel)
                    .addComponent(button_SaveAsNew)
                    .addComponent(button_Save)
                    .addComponent(text_Status, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void slider_Left_Light_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Left_Light_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Left_Light.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Left_Light_StateChanged

    private void slider_Left_Heat_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Left_Heat_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Left_Heat.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Left_Heat_StateChanged

    private void slider_Left_Water_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Left_Water_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Left_Water.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Left_Water_StateChanged

    private void slider_Left_Power_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Left_Power_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Left_Power.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Left_Power_StateChanged

    private void slider_MotorStrength_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_MotorStrength_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_MotorStrength.setText(Integer.toString(value));
}//GEN-LAST:event_slider_MotorStrength_StateChanged

    private void slider_Right_Light_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Right_Light_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Right_Light.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Right_Light_StateChanged

    private void slider_Right_Heat_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Right_Heat_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Right_Heat.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Right_Heat_StateChanged

    private void slider_Right_Water_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Right_Water_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Right_Water.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Right_Water_StateChanged

    private void slider_Right_Power_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Right_Power_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Right_Power.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Right_Power_StateChanged

    private void slider_Aggression_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Aggression_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Aggression.setText(Integer.toString(value));
}//GEN-LAST:event_slider_Aggression_StateChanged

    private void slider_Red_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Red_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Red.setText(Integer.toString(value));
        updateColour();
}//GEN-LAST:event_slider_Red_StateChanged

    private void slider_Green_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Green_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Green.setText(Integer.toString(value));
        updateColour();
}//GEN-LAST:event_slider_Green_StateChanged

    private void slider_Blue_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_Blue_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_Blue.setText(Integer.toString(value));
        updateColour();
}//GEN-LAST:event_slider_Blue_StateChanged

    private void dropdown_SelectedVehicleItemStateChanged(ItemEvent evt) {//GEN-FIRST:event_dropdown_SelectedVehicleItemStateChanged
        JComboBox tempComboBox = (JComboBox) evt.getSource();
        EditorVehicle selected = (EditorVehicle) tempComboBox.getSelectedItem();
        populateFields(selected);
        updateColour();
}//GEN-LAST:event_dropdown_SelectedVehicleItemStateChanged

    private void formWindowGainedFocus(WindowEvent evt) {//GEN-FIRST:event_formWindowGainedFocus
        dropdown_SelectedVehicle.requestFocus();
    }//GEN-LAST:event_formWindowGainedFocus

    private void slider_MaxBattery_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_MaxBattery_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_MaxBattery.setText(Integer.toString(value));
}//GEN-LAST:event_slider_MaxBattery_StateChanged

    private void slider_CurrentBattery_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_CurrentBattery_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_CurrentBattery.setText(Integer.toString(value));
}//GEN-LAST:event_slider_CurrentBattery_StateChanged

    private void slider_MemMaxCapacity_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_MemMaxCapacity_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_MemMaxCapacity.setText(Integer.toString(value));
}//GEN-LAST:event_slider_MemMaxCapacity_StateChanged

    private void slider_MemLearnRate_StateChanged(ChangeEvent evt) {//GEN-FIRST:event_slider_MemLearnRate_StateChanged
        JSlider tempSlider = (JSlider) evt.getSource();
        int value = tempSlider.getValue();
        text_MemLearnRate.setText(Integer.toString(value));
}//GEN-LAST:event_slider_MemLearnRate_StateChanged

    private void processing_AppearanceComponentResized(ComponentEvent evt) {//GEN-FIRST:event_processing_AppearanceComponentResized
        proVehiclePreview.updateSize(processing_Appearance.getWidth(), processing_Appearance.getHeight());
    }//GEN-LAST:event_processing_AppearanceComponentResized

    private void tab_PropertiesFocusGained(FocusEvent evt) {//GEN-FIRST:event_tab_PropertiesFocusGained
        proVehiclePreview.start();
    }//GEN-LAST:event_tab_PropertiesFocusGained

    private void tab_PropertiesFocusLost(FocusEvent evt) {//GEN-FIRST:event_tab_PropertiesFocusLost
        proVehiclePreview.destroy();
    }//GEN-LAST:event_tab_PropertiesFocusLost

    private void populateFields(EditorVehicle p_vehicle) {
        EditorVehicle tempVehicle = p_vehicle;

        text_Author.setText(tempVehicle.getAuthor());
        text_Description.setText(tempVehicle.getDescription());
        text_Name.setText(tempVehicle.getName());
        text_LastModified.setText(tempVehicle.getLastModified());

        slider_Red.setValue(tempVehicle.getVehicleColourRed());
        slider_Blue.setValue(tempVehicle.getVehicleColourBlue());
        slider_Green.setValue(tempVehicle.getVehicleColourGreen());

        slider_Left_Heat.setValue(tempVehicle.getLeftSensorHeat());
        slider_Left_Light.setValue(tempVehicle.getLeftSensorLight());
        slider_Left_Power.setValue(tempVehicle.getLeftSensorPower());
        slider_Left_Water.setValue(tempVehicle.getLeftSensorWater());
        
        slider_Right_Heat.setValue(tempVehicle.getRightSensorHeat());
        slider_Right_Light.setValue(tempVehicle.getRightSensorLight());
        slider_Right_Power.setValue(tempVehicle.getRightSensorPower());
        slider_Right_Water.setValue(tempVehicle.getRightSensorWater());

        slider_Aggression.setValue(tempVehicle.getAggression());
        slider_MotorStrength.setValue(tempVehicle.getMotorStrength());

        slider_MaxBattery.setValue(tempVehicle.getMaxBatteryCapacity());
        slider_CurrentBattery.setValue(tempVehicle.getCurrentBatteryCapacity());

        slider_MemLearnRate.setValue(tempVehicle.getLearningRate());
        slider_MemMaxCapacity.setValue(tempVehicle.getMaxMem());
}

    @Action
    public void saveVehicle() {
        EditorVehicle v = (EditorVehicle) dropdown_SelectedVehicle.getSelectedItem();
        v.setName(text_Name.getText()); //set object attributes
		v.setAuthor(text_Author.getText());
		v.setDescription(text_Description.getText());
		v.setMotorStrength(slider_MotorStrength.getValue());
		v.setAggression(slider_Aggression.getValue());
        v.setMaxBatteryCapacity(slider_MaxBattery.getValue());
        v.setCurrentBatteryCapacity(slider_CurrentBattery.getValue());
        v.setMaxMem(slider_MemMaxCapacity.getValue());
        v.setLearningRate(slider_MemLearnRate.getValue());
		v.setColour(slider_Red.getValue(), slider_Green.getValue(), slider_Blue.getValue());
		v.setLeftSensorHeat(slider_Left_Heat.getValue());
		v.setLeftSensorLight(slider_Left_Light.getValue());
		v.setLeftSensorPower(slider_Left_Power.getValue());
		v.setLeftSensorWater(slider_Left_Water.getValue());
		v.setRightSensorHeat(slider_Right_Heat.getValue());
		v.setRightSensorLight(slider_Right_Light.getValue());
		v.setRightSensorPower(slider_Right_Power.getValue());
		v.setRightSensorWater(slider_Right_Water.getValue());
		v.saveVehicle(); //convert object and its attributes into XML
        String lastModified = v.getLastModified();
        appRoot.setVehicleArray();
        vehicleArray = appRoot.getVehicleArray();
        vehiclesDropDown = new DefaultComboBoxModel(vehicleArray);
        for (int i = 0; i < vehicleArray.length; i++) {
            if (vehicleArray[i].getLastModified().equalsIgnoreCase(lastModified)) {
                v = vehicleArray[i];
            }
        }
        dropdown_SelectedVehicle.setModel(vehiclesDropDown);
        dropdown_SelectedVehicle.requestFocus();
        dropdown_SelectedVehicle.setSelectedItem(v);
        populateFields(v);
    }

    @Action
    public void saveVehicleAs() {
        String filename = UtilMethods.formatString(text_Name.getText());
        EditorVehicle v = new EditorVehicle("xml/vehicles/" + filename + ".veh");
        v.setName(text_Name.getText()); //set object attributes
		v.setAuthor(text_Author.getText());
		v.setDescription(text_Description.getText());
		v.setMotorStrength(slider_MotorStrength.getValue());
		v.setAggression(slider_Aggression.getValue());
        v.setMaxBatteryCapacity(slider_MaxBattery.getValue());
        v.setCurrentBatteryCapacity(slider_CurrentBattery.getValue());
        v.setMaxMem(slider_MemMaxCapacity.getValue());
        v.setLearningRate(slider_MemLearnRate.getValue());
		v.setColour(slider_Red.getValue(), slider_Green.getValue(), slider_Blue.getValue());
		v.setLeftSensorHeat(slider_Left_Heat.getValue());
		v.setLeftSensorLight(slider_Left_Light.getValue());
		v.setLeftSensorPower(slider_Left_Power.getValue());
		v.setLeftSensorWater(slider_Left_Water.getValue());
		v.setRightSensorHeat(slider_Right_Heat.getValue());
		v.setRightSensorLight(slider_Right_Light.getValue());
		v.setRightSensorPower(slider_Right_Power.getValue());
		v.setRightSensorWater(slider_Right_Water.getValue());
		v.saveVehicle(); //convert object and its attributes into XML
        String lastModified = v.getLastModified();
        appRoot.setVehicleArray();
        vehicleArray = appRoot.getVehicleArray();
        vehiclesDropDown = new DefaultComboBoxModel(vehicleArray);
        for (int i = 0; i < vehicleArray.length; i++) {
            if (vehicleArray[i].getLastModified().equalsIgnoreCase(lastModified)) {
                v = vehicleArray[i];
            }
        }
        dropdown_SelectedVehicle.setModel(vehiclesDropDown);
        dropdown_SelectedVehicle.requestFocus();
        dropdown_SelectedVehicle.setSelectedItem(v);
        populateFields(v);
    }

    public void updateColour() {
        proVehiclePreview.updateColor(slider_Red.getValue(), slider_Green.getValue(), slider_Blue.getValue());
	}
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private JButton button_Cancel;
    private JButton button_Save;
    private JButton button_SaveAsNew;
    private JComboBox dropdown_SelectedVehicle;
    private JLabel label_CurrentBattery;
    private JLabel label_MaxBattery;
    private JLabel label_MemLearnRate;
    private JLabel label_MemMaxCapacity;
    private JPanel panel_Aggression;
    private JPanel panel_Appearance;
    private JPanel panel_Author;
    private JPanel panel_BatteryCapacity;
    private JPanel panel_Blue;
    private JPanel panel_Description;
    private JPanel panel_Green;
    private JPanel panel_LastModified;
    private JPanel panel_LeftSensor;
    private JPanel panel_Left_Heat;
    private JPanel panel_Left_Light;
    private JPanel panel_Left_Power;
    private JPanel panel_Left_Water;
    private JPanel panel_Memory;
    private JPanel panel_MotorStrength;
    private JPanel panel_Name;
    private JPanel panel_Red;
    private JPanel panel_RightSensor;
    private JPanel panel_Right_Heat;
    private JPanel panel_Right_Light;
    private JPanel panel_Right_Power;
    private JPanel panel_Right_Water;
    private JPanel panel_SelectedVehicle;
    private JPanel processing_Appearance;
    private JScrollPane scrollpanel_Description;
    private JSlider slider_Aggression;
    private JSlider slider_Blue;
    private JSlider slider_CurrentBattery;
    private JSlider slider_Green;
    private JSlider slider_Left_Heat;
    private JSlider slider_Left_Light;
    private JSlider slider_Left_Power;
    private JSlider slider_Left_Water;
    private JSlider slider_MaxBattery;
    private JSlider slider_MemLearnRate;
    private JSlider slider_MemMaxCapacity;
    private JSlider slider_MotorStrength;
    private JSlider slider_Red;
    private JSlider slider_Right_Heat;
    private JSlider slider_Right_Light;
    private JSlider slider_Right_Power;
    private JSlider slider_Right_Water;
    private JTabbedPane tabContainer;
    private JPanel tab_Attributes;
    private JPanel tab_Design;
    private JPanel tab_Properties;
    private JTextField text_Aggression;
    private JTextField text_Author;
    private JTextField text_Blue;
    private JTextField text_CurrentBattery;
    private JTextArea text_Description;
    private JTextField text_Green;
    private JTextField text_LastModified;
    private JTextField text_Left_Heat;
    private JTextField text_Left_Light;
    private JTextField text_Left_Power;
    private JTextField text_Left_Water;
    private JTextField text_MaxBattery;
    private JTextField text_MemLearnRate;
    private JTextField text_MemMaxCapacity;
    private JTextField text_MotorStrength;
    private JTextField text_Name;
    private JTextField text_Red;
    private JTextField text_Right_Heat;
    private JTextField text_Right_Light;
    private JTextField text_Right_Power;
    private JTextField text_Right_Water;
    private JTextField text_Status;
    // End of variables declaration//GEN-END:variables
    private VehiclePreview proVehiclePreview;
    private EditorVehicle[] vehicleArray;
    private DefaultComboBoxModel vehiclesDropDown;
    private Simulator appRoot;

}
